package service

import (
	"context"
	pb "demo_grpc/proto"
)

// 定义server，用来实现proto文件，里面实现的Greeter服务里面的接口
type User struct {
	pb.UnimplementedUserInfoServer
}

func (u *User) GetUserInfo(ctx context.Context, in *pb.UserInfoRequest) (*pb.UserInfoReply, error) {
	m := map[int]pb.UserInfoReply{
		1: {
			Name: "赵宾",
			Age:  27,
		},
		2: {
			Name: "zhao1", Age: 12,
		},
	}
	data := m[int(in.Id)]
	return &data, nil
}
